package edu.hgnc.supplier;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Lookup;

/**
 * @see org.springframework.beans.factory.InitializingBean  最后一次所有属性值都填充完成了，再改一次属性值
 */
public class User implements InitializingBean {

	private Integer id;
	private String username;

	public User(){

	}

	public User(Integer id, String username) {
		this.id = id;
		this.username = username;
	}

	public User(Integer id) {
		this.id = id;
	}

	public User(String username) {
		this.username = username;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		// 鸡肋。。。。没啥意义
		if (this.getUsername().equals("str")){
			this.setUsername("STR");
			System.out.println("最后修改属性值");
		}
	}
}
